package com.yowasa.xiuxian.engine;

import com.google.common.collect.Maps;
import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.annoations.Mental;
import com.yowasa.xiuxian.engine.hone.MentalInterface;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 修炼引擎
 */
@Component
public class HoneEngine implements InitializingBean {
    @Autowired
    private List<MentalInterface> mentalList;

    public static Map<String, MentalInterface> mentalMap;


    @Override
    public void afterPropertiesSet() {
        mentalMap = Maps.newHashMap();
        mentalList.stream().forEach(e -> {
            Mental annotation = e.getClass().getAnnotation(Mental.class);
            if (annotation != null) {
                String name = annotation.name();
                mentalMap.put(name, e);
            }
        });
    }


    //参悟心法


    //参悟战技

    //

}
